import request from "@/utils/request";
import store from "@/store";

export default {
  /**
   * 新建文件夹
   * @param {文件夹名称} name
   */
  newFolder(name) {
    const path = store.getters.getBackTop;
    return request({
      url: `/folder/newFolder`,
      method: "post",
      data: {
        name,
        path,
      },
    });
  },
  enterFolder() {
    const rootPath = store.getters.getBackTop;
    store.commit("resetForward");
    //获取当前url
    return request({
      url: "/folder/enterFolder",
      method: "get",
      params: {
        path: rootPath,
      },
    });
  },

  skipRouter(path) {
    return request({
      url: "/folder/enterFolder",
      method: "get",
      params: {
        path,
      },
    });
  },
};
